package io.seata.storage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.seata.storage.entity.Storage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author ZengRJ
 */
public interface StorageMapper extends BaseMapper<Storage> {
    @Update("update storage_tbl set `count` = `count` - ${storage.count} where commodity_code = #{storage.commodityCode}")
    int deduct(@Param("storage") Storage storage);

    @Update("update storage_tbl set `count` = `count` + ${storage.count} where commodity_code = #{storage.commodityCode}")
    int refund(@Param("storage") Storage storage);
}
